package com.iweb.day11;

import com.iweb.dao.StudentDao;
import com.iweb.dao.impl.StudentDaoImpl;
import com.iweb.entity.Student;

import java.util.ArrayList;
import java.util.List;

/**
 * @author WuYongheng
 * @date 2021/11/28
 * @description 新增学生数据客户端
 */
public class Cilent {
    public static void main(String[] args) {

        Student student = new Student();
        List<Student> students = new ArrayList<>();
        /*
        // 测试修改
        student.setLoginPwd("Yangguo11");
        student.setStudentName("杨过1");
         */

        /*
        // 测试插入
        student.setStudentNo(5555);
        student.setLoginPwd("wyh");
        student.setStudentName("巫永恒");
        student.setSex(0);
        student.setGradeId(5050);
        student.setPhone("123456456");
        student.setAddress("送到艾瑞3楼");
        student.setBornDate(new Date());
        student.setEmail("5050@qq.com");
        student.setIdentityCard("100086");
         */


        // 测试删除
        Integer integer = 1001;

        /*
        // 测试按学号查询
        Integer integer = 1001;
         */

        // 模糊查询
        // 请出实现类干活
        StudentDao studentDao = new StudentDaoImpl();

        try {
//           int insert = studentDao.insert(student);
//          int update = studentDao.update(student);
//          int delete = studentDao.delete(integer);
            Student select = studentDao.selectById(integer);
//            System.out.println(select.toString());

//            students = studentDao.selectByName("杨过1");
//            for (Student s : students) {
//                System.out.println(s);
//            }

            if (select != null) {
                System.out.println("查询成功");
            } else {
                System.out.println("查询失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
